﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;

namespace SourFruit.level.obj 
{
    public class Collectable : LevelObject
    {
        private int value;
        /// <summary>  
        /// Handles the informing the receivers that the players position has changed.  
        /// </summary>  
        /// <param name="sender">The sender of the event.</param>  
        /// <param name="e">The EventArgs of the event.</param>  
        public delegate void Collected(int id, int value);
        public event Collected ItemCollected;

        public Collectable(int _posX, int _posY, int _width, int _height, Texture2D _texture, int _value)
            : base(_posX, _posY, _width, _height, _texture)
        {
            this.value = _value;
        }

        public Collectable(int _posX, int _posY, int _width, int _height, Texture2D[] _texture, int _imageIntervalMs, int _value)
            : base(_posX, _posY, _width, _height, _texture, _imageIntervalMs)
        {
            this.value = _value;
        }

        public Collectable(int _posX, int _posY, int _width, int _height, Texture2D _texture, int _value, MovingOptions _moves, float _speed)
            : base(_posX, _posY, _width, _height, _texture, _moves, _speed) 
        {
            this.value = _value;
        }

        public Collectable(int _posX, int _posY, int _width, int _height, Texture2D[] _texture, int _imageIntervalMs, int _value, MovingOptions _moves, float _speed)
            : base(_posX, _posY, _width, _height, _texture, _imageIntervalMs, _moves, _speed)
        {
            this.value = _value;
        }

        public void CreateEventCollected()
        {
            if (ItemCollected != null)
            {
                this.CreateEventRemove();
                ItemCollected(this.ID, value);
                
            }
        }
    }
}
